/**
 * <copyright>
 * </copyright>
 *

 */
package de.rwth.adroidGuiLang.impl;

import de.rwth.adroidGuiLang.AdroidGuiLangPackage;
import de.rwth.adroidGuiLang.GuiElement;
import de.rwth.adroidGuiLang.TwoColumnLine;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Two Column Line</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.rwth.adroidGuiLang.impl.TwoColumnLineImpl#getFirstElement <em>First Element</em>}</li>
 *   <li>{@link de.rwth.adroidGuiLang.impl.TwoColumnLineImpl#getSecondElement <em>Second Element</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TwoColumnLineImpl extends MinimalEObjectImpl.Container implements TwoColumnLine
{
  /**
   * The cached value of the '{@link #getFirstElement() <em>First Element</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFirstElement()
   * @generated
   * @ordered
   */
  protected GuiElement firstElement;

  /**
   * The cached value of the '{@link #getSecondElement() <em>Second Element</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSecondElement()
   * @generated
   * @ordered
   */
  protected GuiElement secondElement;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected TwoColumnLineImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return AdroidGuiLangPackage.Literals.TWO_COLUMN_LINE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GuiElement getFirstElement()
  {
    return firstElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetFirstElement(GuiElement newFirstElement, NotificationChain msgs)
  {
    GuiElement oldFirstElement = firstElement;
    firstElement = newFirstElement;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT, oldFirstElement, newFirstElement);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFirstElement(GuiElement newFirstElement)
  {
    if (newFirstElement != firstElement)
    {
      NotificationChain msgs = null;
      if (firstElement != null)
        msgs = ((InternalEObject)firstElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT, null, msgs);
      if (newFirstElement != null)
        msgs = ((InternalEObject)newFirstElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT, null, msgs);
      msgs = basicSetFirstElement(newFirstElement, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT, newFirstElement, newFirstElement));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GuiElement getSecondElement()
  {
    return secondElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetSecondElement(GuiElement newSecondElement, NotificationChain msgs)
  {
    GuiElement oldSecondElement = secondElement;
    secondElement = newSecondElement;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT, oldSecondElement, newSecondElement);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSecondElement(GuiElement newSecondElement)
  {
    if (newSecondElement != secondElement)
    {
      NotificationChain msgs = null;
      if (secondElement != null)
        msgs = ((InternalEObject)secondElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT, null, msgs);
      if (newSecondElement != null)
        msgs = ((InternalEObject)newSecondElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT, null, msgs);
      msgs = basicSetSecondElement(newSecondElement, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT, newSecondElement, newSecondElement));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT:
        return basicSetFirstElement(null, msgs);
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT:
        return basicSetSecondElement(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT:
        return getFirstElement();
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT:
        return getSecondElement();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT:
        setFirstElement((GuiElement)newValue);
        return;
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT:
        setSecondElement((GuiElement)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT:
        setFirstElement((GuiElement)null);
        return;
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT:
        setSecondElement((GuiElement)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__FIRST_ELEMENT:
        return firstElement != null;
      case AdroidGuiLangPackage.TWO_COLUMN_LINE__SECOND_ELEMENT:
        return secondElement != null;
    }
    return super.eIsSet(featureID);
  }

} //TwoColumnLineImpl
